function setCookie(key, value, ops){
    ops = ops || {};
    let p = ops.path ? ';path='+ops.path : "";
    let e = "";
    if(ops.expires){
        var d = new Date();
        d.setDate(d.getDate() + ops.expires)
        e = ";expires=" + d
    }
    document.cookie = `${key}=${value}${p}${e}`;
}

function removeCookie(key, ops){
    ops = ops || {};
    ops.expires = -1;
    setCookie(key, "", ops)
}

function getCookie(key){
    const str = document.cookie;
    const arr = str.split("; ");
    for(let i=0;i<arr.length;i++){
        const c = arr[i].split("=");
        if(c[0] === key){
            return c[1];
        }
    }
    return null;
}